#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/mutex.h>
#include <linux/sysfs.h>
#include <linux/mod_devicetable.h>
#include <linux/log2.h>
#include <linux/bitops.h>
#include <linux/jiffies.h>
#include <linux/of.h>
#include <linux/acpi.h>
static unsigned io_limit = 10;

static const struct of_device_id of_match_i2c_driver[] = {//设备树中定义的i2c client 使用 其中的compatible 熟悉进行匹配
        { .compatible = "my,jxhu",           .data = NULL },
        { /* END OF LIST */ },
};
static const struct i2c_device_id i2c_device_ids[] = {//与其它的 i2c 设备匹配的id
	{ "my_i2c_device", 0 },
	{ /* END OF LIST */ }
};
MODULE_DEVICE_TABLE(i2c, i2c_device_ids);



static int i2c_driver_probe(struct i2c_client *client, const struct i2c_device_id *id)
{
	
    return 0;
}


static int i2c_driver_remove(struct i2c_client *client)
{
    return 0;
}
static struct i2c_driver i2c_driver = {
	.driver = {
		.name = "i2c_driver",
		.of_match_table = of_match_i2c_driver,
	},
	.probe = i2c_driver_probe,
	.remove = i2c_driver_remove,
	.id_table = i2c_device_ids,
};


static int __init i2c_driver_init(void)
{
	if (!io_limit) {
		pr_err("at24: io_limit must not be 0!\n");
		return -EINVAL;
	}
	io_limit = rounddown_pow_of_two(io_limit);
	return i2c_add_driver(&i2c_driver);
}
module_init(i2c_driver_init);

static void __exit i2c_driver_exit(void)
{
	i2c_del_driver(&at24_driver);
}
module_exit(i2c_driver_exit);  //模块出口函数   在rmmod 的时候会调用到 

//driver  信息
MODULE_DESCRIPTION("Driver for most I2C ");
MODULE_AUTHOR("author is jx.hu    emil 302501638@qq.com");  //
MODULE_LICENSE("GPL");